﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="goodsList.aspx.cs" Inherits="WebApp.admin.goods.goodsList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>商品列表</title>
    <link href="../css/skin.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/main.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>

<script type="text/javascript">
    $(function () {
        $("#btnImport").click(function () {
            if ($("#fileExcel").val() == "") {
                alert("请选择导入Excel文件！");
                return false;
            }
            if ($("#fileExcel").val() != "") {
                //检测类型
                var val = $("#fileExcel").val().toLowerCase();
                if (/^.*?\.(xls)$/.test(val)) {
                } else {
                    alert("Excel导入只能导入.xls格式的文件！");
                    $("#fileExcel").select();
                    return false;
                }
            }
            return true;
        });
    });
</script>

<body class="body">
    <table class="main" cellpadding="0" cellspacing="0">

        <tr>
            <td class="td_middle_middle">
                <div class="maincontent">
                    <form id="formSearch" action="goodsList.aspx">
                        <input id="btnAddGoods" type="button" style='display:<%=AddDisplay %>; float:left;'  class="formButton" value="商品添加"  onclick="location.href='goodsAdd.aspx?ot=ad';"  />
                        &nbsp;&nbsp; 
                        <label>
                            查找：</label>
                        <select id="selectGoods" name="t">
                            <option value="goodsName" selected="selected">商品名称</option>
                            <option value="goodsNo">商品编号</option>
                            <option value="categoryName">商品分类</option>
                        </select>
                      
                        &nbsp;
                        <input id="txtKeyWord" type="text" name="kw" value="<%=kw %>" />
                        <input id="btnSearch" type="submit" class="formButton" value="搜  索" />
                        &nbsp;&nbsp;
                        <%--<input id="btnIntegral" type="button" class="formButton" value="可兑换礼品" onclick="location.href='?type=integral';" />
                         &nbsp;&nbsp;--%>
                        <label>
                            每页显示：</label>
                        <select id="selectPageSize" name="ps" onchange="SetPageSize();">
                            <option value="10">10</option>
                            <option value="20" selected="selected">20</option>
                            <option value="50">50</option>
                            <option value="100">100</option>
                        </select>
                    </form>
                    <form id="form1" runat="server">
                        <asp:Button ID="btnExport" runat="server" Text="导出Excel" EnableViewState="false" CssClass="formButton" OnClick="btnExport_Click" />
                        &nbsp;&nbsp;
                        <input id="fileExcel" type="file" runat="server" />
                        &nbsp;&nbsp;
                        <asp:Button ID="btnImport" runat="server" Text="Excel导入" EnableViewState="false" CssClass="formButton" OnClick="btnImport_Click" />
                        <table cellpadding="0" cellspacing="0">
                            <tr class="tr_title">
                                <td>
                                    <input name="chkall" value="1" type="checkbox" onclick="CheckAll(this,'Item')" title="全选/反选" />
                                </td>
                                <td>
                                    <span onclick="SetOrder('goodsName');">商品名称</span></td>
                                <td>
                                    <span onclick="SetOrder('goodsNo');">商品编号</span></td>
                                <td>
                                    <span onclick="SetOrder('category');">商品分类</span></td>
                                <td>
                                    <span onclick="SetOrder('salePrice');">销售价格</span></td>
                                <td>
                                    <span onclick="SetOrder('isShelves');">商城上架</span></td>
                                <td>
                                    <span onclick="SetOrder('isProfShelves');">专区上架</span></td>
                                <td>
                                    <span onclick="SetOrder('isBest');">是否精品</span></td>
                                <td>
                                    <span onclick="SetOrder('isNew');">是否新品</span></td>
                                <td>
                                    <span onclick="SetOrder('isTopSelling');">是否热销</span></td>
                                <td> <span onclick="SetOrder('inventory');">显示库存</span></td>
                                <td> <span onclick="SetOrder('realyCount');">实际库存</span></td>
                                <td> <span onclick="SetOrder('inCount');">入库数量</span></td>
                                <td> <span onclick="SetOrder('outCount');">出库数量</span></td>
                                 <td> <span onclick="SetOrder('freezeCount');">冻结数量</span></td>
                                <td>
                                    <span onclick="SetOrder('isFromFreight');">运费</span></td>
                                <td>
                                    操作</td>
                            </tr>
                            <asp:Repeater ID="rptGoods" runat="server"  onitemdatabound="rptGoods_ItemDataBound" >
                                <ItemTemplate>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <input id='cb<%# Eval("id") %>' name="Item" type="checkbox" onclick="ShowDelete();"
                                                    value='<%# Eval("id") %>' /></td>
                                            <td>
                                                <a href="goods.aspx?show=1&id=<%# Eval("id") %>" >
                                                    <%# Eval("goodsName")%>
                                                </a>
                                            </td>

                                            <td>
                                                <%# Eval("goodsNo")%>
                                            </td>
                                            <td>
                                                <%# GetCategoryName(Eval("category"))%>
                                            </td>
                                            <td>
                                                <%# Eval("salePrice")%>
                                            </td>
                                            <td>
                                                <%# Convert.ToInt32(Eval("isShelves"))==1?"是":"否"%>
                                                </td>
                                              <td>
                                                <%# Convert.ToInt32(Eval("isProfShelves")) == 1 ? "是" : "否"%>
                                            </td>
                                            <td>
                                                <%# Convert.ToInt32(Eval("isBest"))==1?"是":"否"%>
                                            </td>
                                            <td>
                                                <%# Convert.ToInt32(Eval("isNew"))==1?"是":"否"%>
                                            </td>
                                            <td>
                                                <%# Convert.ToInt32(Eval("isTopSelling"))==1?"是":"否"%>
                                            </td>
                                             <td>
                                                <%# Eval("inventory")%>
                                            </td>
                                            <td>
                                                <%# Eval("realyCount")%>
                                            </td>
                                             <td>
                                                <a onclick="openNewTab('入库列表','/admin/warehouse/warehouseGoodsList.aspx?gid=<%# Eval("id") %>')"  title="明细"> <%# Eval("inCount")%></a>
                                            </td>
                                               <td>
                                                <a onclick="openNewTab('出库列表','/admin/warehouse/warehouseGoodsOutList.aspx?gid=<%# Eval("id") %>')"  title="明细"> <%# Eval("outCount")%></a>
                                            </td>
                                             <td>
                                                <%# Eval("freezeCount")%>
                                            </td>
                    
                                            <td>
                                                <%# Convert.ToInt32(Eval("isFromFreight"))==0?"买家承担":"卖家承担" %>
                                            </td>
                                            <td>
                                              <div style="float:left; display:block;" id="divEdit" runat="server">   <a href="goods.aspx?id=<%# Eval("id") %>&ot=ed"  title="编辑">[编辑]</a></div>
                                              <div style="float:left; display:block;" id="divInStore" runat="server">   <a href='/admin/warehouse/warehouseGoods.aspx?gid=<%# Eval("id") %>' target="_self" title="入库">[入库]</a></div>
                                               <div style="float:left; display:block;" id="divOutStore" runat="server">   <a href='/admin/warehouse/warehouseGoods.aspx?gid=<%# Eval("id") %>' target="_self" title="出库">[出库]</a></div>
                                              <div style="float:left; display:block;" id="divDeleted" runat="server"><a title="删除" href="goodsList.aspx?action=del&amp;id=<%# Eval("id") %>" onclick="javascript:return confirm('确定要删除吗?');">[删除]</a></div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <tr>
                                        <td colspan="17" style="text-align: center;">
                                            <label id="lblEmpty" style='display: <%# rptGoods.Items.Count==0?"block":"none"%>;
                                                color: Red;'>
                                                没有找到任何记录</label>
                                        </td>
                                    </tr>
                                </FooterTemplate>
                            </asp:Repeater>
                        </table>
                        <asp:Button ID="btnDelete" runat="server" Text="删除" OnClientClick="return confirm('确定要删除吗？');"
                            OnClick="btnDelete_Click" EnableViewState="false" CssClass="formButton" />
                        <% Response.Write((new Gift.WebApp.PageListNo()).DisplayPage(total, pageSize, pageIndex)); %>
                    </form>
                </div>
            </td>

        </tr>
      
    </table>
</body>
</html>
















